package ac.neec.mio.ui.fragment;

import org.afree.chart.AFreeChart;
import org.afree.graphics.geom.RectShape;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;

public class SamplePieChartView extends View {
private AFreeChart chart;
public SamplePieChartView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
RectShape chartArea = new RectShape(0.0, 0.0, 200.0, 200.0);
this.chart.draw(canvas, chartArea);
}
//グラフビューのサイズを決めているらしい。小さくするとグラフも切れてしまう。
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(200, 200);
}
public void setChart(AFreeChart chart) {
this.chart = chart;
}
}